package com.persondemo.videoappliction.ui.vip.presenter;

import com.persondemo.videoappliction.bean.VipBean;
import com.persondemo.videoappliction.net.BaseApi;
import com.persondemo.videoappliction.net.BaseObserver;
import com.persondemo.videoappliction.net.RxSchedulers;
import com.persondemo.videoappliction.ui.base.BasePresenter;
import com.persondemo.videoappliction.ui.vip.contract.VipContract;

import javax.inject.Inject;

/**
 * Created by Administrator on 2018/4/9.
 */

public class VipPresenter extends BasePresenter<VipContract.View> implements VipContract.presenter {
    private BaseApi baseApi;

    @Inject
    public VipPresenter(BaseApi baseApi) {
        this.baseApi = baseApi;
    }

    @Override
    public void getgeata(String imei) {
    baseApi.getvip(imei)
            .compose(RxSchedulers.applySchedulers())
            .compose(mView.bindToLife())
            .subscribe(new BaseObserver<VipBean>() {
                @Override
                public void onSuccess(VipBean vipBean) {
                    mView.showdata(vipBean);
                }
                @Override
                public void onFail(Throwable e) {
                    mView.showFaild();
                }
            });
    }
}
